<?php
class MenuAccordWidget extends CWidget
{
	public $title = '';
	private $_url = NULL;
	public $_catID = 0;
	public function init()
	{
		$dir = dirname(__FILE__).DIRECTORY_SEPARATOR.'assets';
		$this->_url = Yii::app()->getAssetManager()->publish($dir);
		$cs = Yii::app()->getClientScript();
		$cs->registerCssFile("{$this->_url}/css/menuaccord.css");
		$cs->registerCoreScript('jquery');
		$cs->registerScriptFile("{$this->_url}/js/scriptbreaker-multiple-accordion-1.js");
		$cs->registerScript(
				'topnav',
				'$(".topnav").accordion({
					accordion:false,
					speed: 500,
					closedSign: "<img src=\''.$this->_url.'/images/arrow_mn.png\' />",
					openedSign: "<img src=\''.$this->_url.'/images/arrow_actived.png\' />",
					notSign: "<img src=\''.$this->_url.'/images/dot.gif\' />"
				});',
				CClientScript::POS_READY
		);
		
		parent::init();
	}
	public function run()
	{
		$CategoryRoot = FrontendShopCategoryModel::getCategory($this->_catID);
		$this->render('default', array(
					'CategoryRoot' => $CategoryRoot
				));
	}
}